/*
 * @Author: your name
 * @Date: 2020-11-22 13:58:14
 * @LastEditTime: 2020-11-22 14:10:31
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \demo01\src\Boss.js
 */
// react做业务逻辑，css才是主角
import React, { Component } from 'react';
class Boss extends Component {
    constructor(props) {
        super(props);
        this.state = {
            isShow: true
        }
        // 使this指向正确
        this.toToggole=this.toToggole.bind(this)
    }
    render() {
        return (
            <div>
                <div className={this.state.isShow?'show':'hide'}>Boss级人物 孙悟空</div>
                <div><button onClick={this.toToggole}>召唤Boss</button></div>
            </div>
        );
    }

    toToggole() {
        // 来回变换
        this.setState({
            isShow:this.state.isShow?false:true
        })
    }
}

export default Boss;